home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
X-Demos and Utilities
/
(c)x2.d64
/
sped.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
164 lines
5 PRINT"[147]SPRITE EDITOR":PRINT"BY ANDY FINKEL":PRINT"(C)1982 BY COMMODORE":IFFLTHEN105
10 POKE52,48:POKE56,48:CLR:FORI=0TO15:READA$:NEXT
50 FORI=0TO128:READA:POKEI+12*4096,A:NEXT
100 CO$=CHR$(13)+"* [157][145][147]ENMXCTPSA[133]LRD+-[134]BQOZ"+CHR$(148)+CHR$(20):NA$=" "
105 DEFFNA(I)=N*64+3*Y+INT(X/8)+I:DEFFNC(I)=IAND7
110 DEFFNB(J)=-((ZAND2^(7-J))>0)*42-((ZAND2^(7-J))=0)*32
115 DEFFNS(P)=PEEK(P+((J*3+INT(I/8))AND63))AND2^(IAND7)
116 DEFFNM(P)=P+((Y1*3+INT(X1/8))AND63)
117 DEFFNI(I)=(7-IAND7)+(IAND8)+(IAND16)
125 POKE650,128::CL=55296:V=13*4096:Z$="[157][148] ":BL$=" ":L=0
130 SC=1024:S=2040:POKEV+21,4:POKEV+4,30:POKEV+5,228:POKEV+23,0:POKEV+29,0
140 POKEV+28,0:D=12288:POKES+2,192:N=0:AD=48:FL=1:F=0:L=0:B9=12*4096+1024
146 POKEV+41,5:POKEV+37,2:POKEV+38,7:GOSUB770:GOSUB630
180 CR=SC:X=0:Y=0
190 CS=PEEK(CR):POKECR,CSOR128
200 GETA$:IFA$=""THEN200
205 FORI=1TOLEN(CO$):IFMID$(CO$,I,1)<>A$THENNEXT:GOTO200
206 ONIGOTO550,530,520,580,590,600,610,540,570,560,490,430,450,231,221,251,241
207 ONI-17GOTO340,210,470,215,370,421,587,585,209,300,240,410,395,566,568
209 A=PEEK(V+33)+1:A=A+(A>15)*16:POKEV+33,A:GOTO190
210 DN=2:GOSUB690:GOSUB685:PRINT" $"B$:AD=VAL(LEFT$(B$,1))*16+VAL(MID$(B$,2,1)):GOTO190
215 DN=1:GOSUB690:GOSUB685:PRINT" "B$:NA$=B$+LEFT$(" ",6-LEN(B$))
216 OPEN1,8,12,B$+",P,R":GET#1,A$,A$:DN=12:FORI=FTOL:GOSUB685:PRINT""I" "
217 FORJ=0TO63:GOSUB685:GET#1,A$:IFST<>0THEN220
218 A=0:IFA$<>""THENA=ASC(A$)
219 POKE(J+D+I*64),A:NEXTJ,I
220 CLOSE1:GOSUB685:PRINTBL$:GOSUB630:GOTO190
221 DN=5:A=41:GOSUB901:POKEV+A,C:PRINT" "A$:DN=6:A=37:GOSUB901
225 POKEV+A,C:PRINT" "A$:DN=7:A=38:GOSUB901:POKEV+A,C:PRINT" "A$:GOTO190
231 DN=8:GOSUB685:PRINTBL$:GOSUB765:IFA$="YES"THENPOKEV+29,PEEK(V+29)OR4
232 IFA$="NO "THENPOKEV+29,PEEK(V+29)AND(255-4)
233 DN=9:GOSUB685:PRINTBL$:GOSUB765:IFA$="YES"THENPOKEV+23,PEEK(V+23)OR4:GOTO190
234 POKEV+23,PEEK(V+23)AND(255-4):GOTO190
240 POKE650,0:PRINT"[147]":END
241 DN=10:GOSUB690:A=VAL(B$)
242 IFA=0THENA=PEEK(V+4)+PEEK(V+16)*64
243 POKEV+16,-4*(A>255):POKEV+4,(AAND255):B$=STR$(A):GOSUB685:PRINT""B$
244 DN=11:GOSUB690:A=VAL(B$):IFA=0THENA=PEEK(V+5)
245 POKEV+5,A:B$=STR$(A):GOSUB685:PRINT""B$:GOTO190
251 DN=4:GOSUB690:T$="HIRES":IFA$="M"THENT$="MULTI"
252 GOSUB685:PRINT" "T$:POKEV+28,4*-(T$="MULTI"):GOTO190
300 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",S,W"
305 DN=12:FORI=FTOL:GOSUB685:PRINT""I" ":PRINT#1,"SPRITE"+STR(I):FORJ=0TO7:A$=".BYT"
310 FORK=0TO7:A$=A$+STR$(PEEK(J*8+K+D+I*64))+",":NEXT:A$=LEFT$(A$,LEN(A$)-1)
330 PRINT#1,A$:NEXT:NEXT:PRINT#1,".END":CLOSE1:GOSUB685:PRINTBL$:GOTO190
340 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",P,W"
350 PRINT#1,CHR$(0);CHR$(AD);:DN=12:FORI=FTOL:GOSUB685:PRINT""I" "
360 FORJ=0TO63:GOSUB685:PRINT#1,CHR$(PEEK(J+D+I*64));:NEXT:NEXT
365 PRINT#1:CLOSE1:GOSUB685:PRINTBL$:GOTO190
370 DN=3:GOSUB690:FORI=1TOLEN(B$):IFMID$(B$,I,1)<>":"THENNEXT
380 F=ABS(VAL(MID$(B$,1,I-1))):F=F+(F>47)*48
385 L=ABS(VAL(MID$(B$,I+1))):L=L+(L>47)*48
390 GOSUB685:PRINT""STR$(F)":"STR$(L):GOTO190
395 DN=12:GOSUB685:PRINT"[157][157][157][157][157]X,Y :";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
396 FORI=1TOLEN(B$):IFMID$(B$,I,1)<>","THENNEXT:B$=B$+","+B$
397 XO=VAL(MID$(B$,1,I-1)):YO=VAL(MID$(B$,I+1))
398 DN=12:GOSUB685:PRINT"[157][157][157][157][157]ANG :";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
400 DT=VAL(B$)*(null)/180:C1=COS(DT):C2=SIN(DT)
401 X=0:Y=0:FORI=0TO63:POKEB9+I,PEEK(N*8+D+I):POKEN*8+D+I,0:NEXT:FORI=0TO23
402 POKEI-(I=0)+839+CL,15:POKEI+840+CL,0
405 FORJ=0TO20:I1=FNI(I)-XO:J1=J-YO:IFFNS(B9)=0THEN409
406 X1=INT(XO+I1*C1-J1*C2):Y1=INT(YO+I1*C2+J1*C1):IFX1>23ORY1>20THEN409
407 IFX1>23ORY1>20ORX1<0ORY1<0THENPRINT"ERROR"
408 X1=FNI(X1):POKEFNM(N*8+D),PEEK(FNM(N*8+D))OR(2^(X1AND7))
409 NEXT:NEXT:POKE863+CL,15:GOSUB630:GOTO180
410 DN=12:GOSUB685:PRINT"[157][157][157][157][157]MASK:";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
411 FORI=0TO63:POKEN*64+I+D,PEEK(A*64+I+D)ORPEEK(N*64+I+D):NEXT:GOSUB630:GOTO180
421 DN=12:GOSUB685:PRINT"[157][157][157][157][157]TIME:";:GOSUB695:SP=VAL(B$):N=T
422 GOSUB685:PRINT"[157][157][157][157][157]SPR#":FORN=FTOL:GOSUB685:PRINT""STR$(N)" "
423 POKES+2,192+N:GOSUB630:FORJ=0TOSP:NEXT:GETA$:IFSP=0THENGOSUB940
424 IFA$=CHR$(13)THEN426
425 NEXT:GOTO422
426 N=T:POKES+2,192+N:GOSUB630:GOSUB685:PRINT"[157][157][157][157][157] "BL$:GOTO190
430 N=N-(N<47):DN=0:GOTO495
450 DN=12:GOSUB685:PRINT"[157][157][157][157][157]MASK:";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
455 FORI=0TO63:POKEN*64+I+D,PEEK(A*64+I+D):NEXT:GOSUB630:GOTO180
470 DN=13:GOSUB685:PRINT"[157][157][157][157][157]";:FL=FL*-1:IFFL>0THENGOSUB815:A=30:B=0:C=228:GOTO476
475 FORI=1TO10:PRINTTAB(26)" ":NEXT:PRINTTAB(26)" ";:B=4:A=4:C=184
476 PRINT"":POKEV+16,B:POKEV+4,A:POKEV+5,C:DN=10:GOSUB685:PRINT""STR$(B*64+A)" "
477 DN=11:GOSUB685:PRINT""STR$(C)" ":GOTO190
490 DN=0:GOSUB660:IFA<48THENN=A
495 GOSUB685:PRINTTAB(31)""N:POKES+2,N+192:GOSUB630:GOTO180
520 POKECR,32:POKEFNA(D),PEEK(FNA(D))AND(255-2^(7-FNC(X))):GOTO580
530 POKECR,42:POKEFNA(D),PEEK(FNA(D))OR(2^(7-FNC(X))):GOTO580
540 Y=0
550 X=0:GOTO620
560 FORY=0TO20:FORX=0TO16STEP8:POKEFNA(D),256+NOT(PEEK(FNA(D))):NEXT:NEXT
565 GOSUB630:GOTO180
566 T=X:C=0:FORX=0TO16STEP8:I=PEEK(FNA(D)):J=(IAND254)/2+C*128:C=IAND1
567 POKEFNA(D),J:NEXT:GOSUB630:X=T:GOTO190
568 T=X:C=0:FORX=16TO0STEP-8:I=PEEK(FNA(D)):J=(IAND127)*2+C/128:C=IAND128
569 POKEFNA(D),J:NEXT:GOSUB630:X=T:GOTO190
570 FORY=0TO20:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:NEXT:GOSUB630:GOTO180
580 X=X+1+(X>22):GOTO620
585 T=Y:T1=X:FORY=T+1TO20:FORX=0TO16STEP8:POKEFNA(D)-3,PEEK(FNA(D)):NEXT:NEXT
586 Y=20:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:X=T1:Y=T:GOSUB630:GOTO190
587 T=Y:T1=X:FORY=20TOT+1STEP-1:FORX=0TO16STEP8:POKEFNA(D),PEEK(FNA(D)-3)
588 NEXT:NEXT:Y=T:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:X=T1:GOSUB630:GOTO190
590 X=X-1-(X<1):GOTO620
600 Y=Y-1-(Y<1):GOTO620
610 Y=Y+1+(Y>19)
620 CS=PEEK(CR):POKECR,CSAND127:CR=SC+X+Y*40:GOTO190
630 REM DISPLAY SPRITE
640 A=N*64+D:POKE167,A-INT(A/256)*256:POKE168,INT(A/256):SYS12*4096:RETURN
660 GOSUB690:A=VAL(B$):RETURN
685 PRINT"":IFDN>0THENFORKI=1TODN:PRINT"";:NEXT
686 PRINTTAB(31);:RETURN
690 GOSUB685:PRINTBL$:GOSUB685
695 B$="":PRINT" [166][157]";
700 GETA$:IFA$=""THEN700
710 IFASC(A$)=13THENA$=LEFT$(B$,1):GOSUB685:PRINTBL$:RETURN
720 IFASC(A$)=20ANDLEN(B$)=0THEN700
730 IFASC(A$)=20THENB$=LEFT$(B$,LEN(B$)-1):PRINT" [157][157][166][157]";:GOTO700
740 IFLEN(B$)>4ORASC(A$)<31THEN700
750 B$=B$+A$:PRINT"[159]"A$"[166][157]";:GOTO700
765 GOSUB690:A$="YES":IFLEFT$(B$,1)="N"THENA$="NO "
766 GOSUB685:PRINT" "A$:RETURN
770 PRINT"[147][155]";:FORI=0TO20
785 PRINT" "RIGHT$(STR$(I),1):NEXT
790 PRINT"012345670123456701234567 ":PRINT
800 PRINT""TAB(25)"[156]SPRITE EDITOR "Z$
801 PRINTTAB(25)"[159] SPR#: 0 "Z$
802 PRINTTAB(25)" NAME: "NA$" "Z$
803 PRINTTAB(25)" ADDR: $3000 "Z$
804 PRINTTAB(25)" RANG: 0: 0 "Z$
805 PRINTTAB(25)" TYPE: HIRES "Z$
806 PRINTTAB(25)" FORE: GRN "Z$
807 PRINTTAB(25)" MLT0: RED "Z$
808 PRINTTAB(25)" MLT1: YEL "Z$
809 PRINTTAB(25)" XEXP: NO "Z$
810 PRINTTAB(25)" YEXP: NO "Z$
811 PRINTTAB(25)" XPOS: 30 "Z$
812 PRINTTAB(25)" YPOS: 228 "Z$
814 PRINTTAB(25)" "Z$
815 PRINTTAB(26)"[160]4[146][159] MOVE/OR
820 [153][163]26)" 5WAITOPEN COLOR/Z
830 PRINTTAB(26)" 6[146][159] X-PAND
850 [153][163]26)" 7WAITOPEN POSITION
860 PRINTTAB(26)" 8[146][159] RANGE
885 [153][163]26)" 9WAITOPEN DISPLAY
886 PRINTTAB(26)" A[146][159] ADDRESS
887 [153][163]26)" BWAITOPEN SAVE
888 PRINTTAB(14)" 1[146][159] EDIT"TAB(26)" C[146][159] LOAD
890 [153][163]14)" 2WAITOPEN NEXT SPR"[163]26)" DWAITOPEN BYTE
892 PRINTTAB(14)" 3[146][159] TYPE"TAB(26)" E[146][159] QUIT";:RETURN
901 GOSUB690:RESTORE:FORC=0TO15:READA$:IFA$<>LEFT$(B$,3)THENNEXT:RESTORE:FORC=0TOPEEK(V+A)AND15:READA$:NEXT
902 GOSUB685:RETURN
940 GETA$:IFA$=""THEN940
950 RETURN
1000 DATA BLK,WHT,RED,CYN,PUR,GRN,BLU,YEL,ORN,BRN,RD2,GY1,GY2,GN2,BL2,GY3
1005 DATA 169,20,133,171,164,171,185,87,192,133,169,185,108,192
1010 DATA 133,170,169,0,133,247,164,247,177,167
1020 DATA 133,248,160,7,165,248,57,79,192,240
1030 DATA 4,169,42,208,2,169,32,145,169,136
1040 DATA 16,238,24,165,169,105,8,133,169,144
1050 DATA 2,230,170,230,247,165,247,201,3,208
1060 DATA 211,24,101,167,133,167,144,2,230,168
1070 DATA 198,171,16,182,96,128,64,32,16,8
1080 DATA 4,2,1,32,248,208,168,128,88,48
1090 DATA 8,224,184,144,104,64,24,240,200,160
1100 DATA 120,80,40,0,7,6,6,6,6,6
1110 DATA 6,6,5,5,5,5,5,5,4,4
1120 DATA 4,4,4,4,4